package org.example;

import java.util.HashMap;
import java.util.Map;

class Solution {
    static final int[][] DIRS = new int[][]{{1, 0}, {0, 1}, {-1, 0}, {0, -1}};

    public boolean judgeCircle(String moves) {
        Map<Character, int[]> dirs = new HashMap<>();
        dirs.put('R', new int[]{1, 0});
        dirs.put('L', new int[]{-1, 0});
        dirs.put('U', new int[]{0, -1});
        dirs.put('D', new int[]{0, 1});
        int x = 0;
        int y = 0;
        for (int i = 0; i < moves.length(); i++) {
            int[] dir = dirs.get(moves.charAt(i));
            x += dir[0];
            y += dir[1];
        }
        return x == 0 && y == 0;
    }
}

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello world!");
    }
}